# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Guillem Rieu <guillemr@gmx.net>

pkgname=dante
pkgver=1.4.3
pkgrel=3
pkgdesc="SOCKS v4 and v5 compatible proxy server and client"
url="https://www.inet.no/dante"
arch=(loong64 x86_64)
license=('custom')
depends=('krb5' 'libxcrypt' 'pam')
backup=('etc/socks.conf'
        'etc/sockd.conf')
source=(ftp://ftp.inet.no/pub/socks/$pkgname-$pkgver.tar.gz
        sockd.tmpfiles.d
        sockd.service)
sha512sums=('c19675b2dee931366caf4a0dd4f44045ae731cc2f986e5d2e4bf498925c7d93a92a32088234d4a9443424f6dfb0796a1fa3fdc7c47e5aa11612c29a101f47888'
            '6c7c3128eb1da82cdb89bc097793597f7a218ea31da5be71ef7cc1180fcac82eee43ae6fbaf9c6bc95782766974e34619a98d288f52e590c9b31503f1ace654d'
            'd3a1929533ea58b2daf0a15eefec80f6cfb39dec688e414a5a7c3321c80e24c9ec0c3a3d2719ed4af5c97d58ec26fecdea77d84b3837bf4d242f37943f2213ce')

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr --sysconfdir=/etc --sbindir=/usr/bin --disable-libwrap
  make
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  install -dm0755 "$pkgdir"/etc
  cp example/{socks,sockd}.conf "$pkgdir"/etc
  install -D -m644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
  install -Dm0644 "$srcdir"/sockd.service "$pkgdir"/usr/lib/systemd/system/sockd.service
  install -Dm0644 "$srcdir"/sockd.tmpfiles.d "$pkgdir"/usr/lib/tmpfiles.d/sockd.conf
}
